package com.mdt.doforms.bienen.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.android.gms.maps.model.LatLng;

public class DrugStoreLocation implements Parcelable{
	
	
	private String name;
	private String address;
	private LatLng location;
		
	public DrugStoreLocation(String name, String address, LatLng location) {
		super();
		this.setName(name);
		this.setAddress(address);
		this.location = location;
	}

	public DrugStoreLocation( Parcel in ){
		this.setName(in.readString());
		this.address = in.readString();
		double lat = in.readDouble();
		double lng = in.readDouble();
		location = new LatLng(lat,lng);
	}
	
	
	public LatLng getLocation() {
		return location;
	}
	
	public void setLocation( LatLng location ){
		this.location = location;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.name);
		dest.writeString(this.address);
		dest.writeDouble(location.latitude);
		dest.writeDouble(location.longitude);
		
	}
	
	/**
	 * * * This field is needed for Android to be able to * create new objects,
	 * individually or as arrays. * * This also means that you can use use the
	 * default * constructor to create the object and use another * method to
	 * hyrdate it as necessary. * * I just find it easier to use the constructor.
	 * * It makes sense for the way my brain thinks ;-) *
	 */
	@SuppressWarnings("rawtypes")
	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		public DrugStoreLocation createFromParcel(Parcel in) {
			return new DrugStoreLocation(in);
		}

		public DrugStoreLocation[] newArray(int size) {
			return new DrugStoreLocation[size];
		}
	}; 
}
